import {sequelize} from "../../init"
import {DataTypes} from "sequelize"




export const MyFileDir = sequelize.define(
    "MyFileDir",
    {
        parentId: {
            type: DataTypes.INTEGER,
            allowNull: false,
            comment: "父级folderId"
        },
        path: {
            type: DataTypes.STRING,
            allowNull: false,
        },
        isFile: {
            type: DataTypes.BOOLEAN,
            allowNull: false,
        },
        isImg: {
            type: DataTypes.BOOLEAN,
            allowNull: false,
        },
        isVideo: {
            type: DataTypes.BOOLEAN,
            allowNull: false,
        },
        size: {
            type: DataTypes.BIGINT,
            allowNull: false,
        },
        thumbnailPath: {
            type: DataTypes.STRING,
            allowNull: true,
            comment: "缩略图路径"
        },
        ext: {
            type: DataTypes.STRING,
            allowNull: false,
            comment: "文件后缀名"
        },
        duration: {
            type: DataTypes.INTEGER,
            allowNull: false,
            comment: "视频播放时长"
        }
    },
    {
        freezeTableName: true,
        paranoid:true, //删除数据为逻辑删除
    }
)




